package m3d30;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

//线程吃
public class aThreadPool {
    public static void main(String[] args) {
        //1创建池，返回ExecutorService接口的实现类
        ExecutorService es = Executors.newFixedThreadPool(2);

        //3传递线程任务
        es.submit(new bRunnableImpl());
        //线程池一值开启，线程使用完就归还线程池
        es.submit(new bRunnableImpl());
        es.submit(new bRunnableImpl());

        //销毁池 不建议
        es.shutdown();
    }
}
